﻿ @*@model HRMS_Model.Job
*@@{
    ViewBag.Title = "Jobs";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

 <div style="">
    <table id="jqgJobs" cellpadding="0" cellspacing="0">
    </table>
    <div id="jqgpJobs" style="text-align: center;">
    </div>
</div>
@section JavaScript{
    <script type="text/javascript">
        $(document).ready(function () {
            $('#jqgJobs').jqGrid({
                //url from which data should get
                url: '@Url.Action("Jobs")',
                //type of data
                datatype: 'json',
                //url access method type
                mtype: 'POST',
                //columns names
                colNames: ['JobId', 'ContacId', 'StartDate', 'EndDate', 'Status', 'ExperienceReq', 'NoOfVacancies', 'JobDescription'],
                //columns model
                colModel: [
                    { name: 'JobId', index: 'JobId', align: 'left', editable: false, width: 80 },
                    { name: 'ContacId', index: 'ContacId', align: 'left', editable: false, width: 80 },
                    { name: 'StartDate', index: 'StartDate', align: 'left', editable: true, edittype: 'text', width: 100, editoptions: { maxlength: 40 }, editrules: { required: true, edithidden: true }, formoptions: { rowpos: 1, colpos: 2} },
                    { name: 'EndDate', index: 'EndDate', align: 'left', editable: true, edittype: 'text', width: 100, editoptions: { maxlength: 40 }, editrules: { required: true, edithidden: true }, formoptions: { rowpos: 1, colpos: 3} },
                    { name: 'Status', index: 'Status', align: 'left', editable: true, edittype: 'text', hidden: true, editoptions: { maxlength: 40 }, editrules: { required: true, edithidden: true }, formoptions: { rowpos: 2, colpos: 1} },
                    { name: 'ExperienceReq', index: 'ExperienceReq', align: 'left', editable: true, edittype: 'text', hidden: true, editoptions: { maxlength: 40 }, editrules: { required: true, edithidden: true }, formoptions: { rowpos: 2, colpos: 2} },
                    { name: 'NoOfVacancies', index: 'NoOfVacancies', align: 'left', editable: true, edittype: 'text', hidden: true, editoptions: { maxlength: 40 }, editrules: { required: true, edithidden: true }, formoptions: { rowpos: 2, colpos: 3} },
                    { name: 'JobDescription', index: 'JobDescription', align: 'left', editable: true, edittype: 'text', hidden: true, editoptions: { maxlength: 40 }, editrules: { required: true, edithidden: true }, formoptions: { rowpos: 2, colpos: 3} },

                ],
                //pager for grid
                pager: $('#jqgpJobs'),
                //number of rows per page
                rowNum: 5,
                //initial sorting column
                sortname: 'JobId',
                //initial sorting direction
                sortorder: 'asc',
                //we want to display total record count
                viewrecords: true,
                //grid height
                height: '100%'
            });
            $('#jqgJobs').jqGrid('navGrid', '#jqgpJobs',
                { add: true, del: true, edit: true, search: false },
                { width: 'auto', url: '@Url.Action("UpdateJobs")' },
                { width: 'auto', url: '@Url.Action("InsertJobs")' },
                { width: 'auto', url: '@Url.Action("DeleteJobs")' });
        });
    </script>
}
